<%@ page language="java" import="java.util.*" pageEncoding="utf-8"  %>
<%@ page import="org.net.device.*,
org.net.device.info.*,
net.sf.json.JSONObject,
org.dolphin.base.jsontools.JSONExchangeData"
%>
<jsp:directive.page import="org.dolphin.base.jsontools.JsonConverter"/>
<jsp:directive.page import="net.sf.json.JSONObject;"/>

	<%
		devicemanager d = new devicemanager();
		d.setDs(org.dolphin.base.data.provider.JDBCFactory.DataSource());
		
		ArrayList al = d.getAllDeviceinfos();
		String outs = "";
		if (al != null) {
			for (int j = 0;j < al.size();j++) {
				String res = JsonConverter.Object2RowString("id,ip,descri,product_desc,location",(deviceinfo)al.get(j));
				res = res.replace("\r\n","");
				if (j < al.size()-1) {
					outs = outs + res + ",";
				} else {
					outs = outs+res;
				}
			}
			if (!outs.equalsIgnoreCase("")) {
				outs = "["+outs+"]";
			}
		}

		JSONExchangeData returndata = new JSONExchangeData();
		returndata.setCode(0);
		returndata.setMessages("成功获得记录");
		returndata.setDatas(outs);
		JSONObject o = JSONObject.fromObject(returndata);
		System.out.println(o.toString());
		out.print(o.toString());

	 %>